package cn.getech.data.metadata.db;

import cn.getech.data.metadata.entity.meta.CollectionTask;

public class OracleStructure extends DBStructure {
    public OracleStructure(String url, String username, String password, String driverClass, String dbName, CollectionTask collectionTask) {
        super(url, username, password, driverClass, dbName, collectionTask);

        rowAndLengthSql = " select  t1.num_rows as tableRows, t2.bytes as  dataLength  from  " +
                "( select t.num_rows from user_tables t where t.table_name='#{tableName}' ) t1, " +
                " (select bytes From dba_segments u where u.segment_type='TABLE' and u.segment_name='#{tableName}') t2";

        columnSql ="SELECT t.column_name AS COLUMN_NAME,t.data_type AS TYPE_NAME, " +
                "( SELECT c.comments FROM all_col_comments c WHERE c.OWNER=t.OWNER " +
                "AND c.table_name=t.table_name  AND c.column_name=t.column_name  AND ROWNUM=1" +
                ") AS REMARKS,t.data_length AS COLUMN_SIZE,t.nullable as IS_NULLABLE " +
                "FROM all_tab_columns t WHERE t.table_name='#{tableName}' and  t.OWNER = '#{userName}' ";

        tablesSql="SELECT  t.OWNER AS userName,t.TABLE_NAME, t.COMMENTS as REMARKS  from all_tab_comments t  " +
                "WHERE  t.TABLE_NAME NOT LIKE '%$%'  and  t.OWNER = '#{userName}'";

    }
}
